import 'package:flutter/cupertino.dart';
//import 'package:flutter_datetime_picker/flutter_datetime_picker.dart';

class DateUtil{

  //返回相差天数
  static int diffrence(DateTime dateTime,DateTime dateTime1){
      return dateTime.difference(dateTime1).inDays;
  }

  ///"2019-07-29 15:32:41"
  static DateTime stringToDate(String date){
      return DateTime.parse(date);
  }

  ///日期转换时间戳
  static int dateToTimeStamp(DateTime dateTime){
      return dateTime.millisecondsSinceEpoch;
  }

  static DateTime timeStampToDate(int timeStamp){

      return DateTime.fromMicrosecondsSinceEpoch(timeStamp);
  }
  ///直接用datetime.tostring 是 2020-06-04 02:29:05.656190Z
  static String formatDateTimeToString(DateTime dateTime){
      return dateTime.toString().split(".")[0];

  }


}